Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements to ratio approximation #1

Merged
merged 1 commit into from
Feb 13, 2024
Merged

Conversation

jolohaga
Copy link
Contributor

Some of the approximation features were in nascent form in previous releases. In this release, we want to bring them closer to completion. Enhancements include:

  • Add a Tonal::Ratio::Approximation::Set class to maintain the approximations and on which methods concerned with them can be located.
  • Add a #by_superparticular strategy for finding approximate ratios.
  • Rename the #approx method to #approximate, which reads better.

Additional changes include:

  • Enhance the #superparticular method to allow assigning the superior part to the numerator (default) or denominator. This allows approaching target ratios from below as well as above. Also, add a factor argument, allowing finding superparticular ratios approaching any desired target ratio.
  • Change the method name #normalize to #denominize. Normalize suggests extra undesired meaning. Denominize is a made up term, but its meaning is closer to what the method is actually doing.
  • Extract the precision argument, located in method signatures, into a constant named PRECISION.
  • Improve the readability of Tonal::Ratio#efficiency, by limiting its precision to 2 decimal places.
  • Make available to_cents from instances of Tonal::Interval.
  • Make ratio an alias to Tonal::Interval#interval.
  • Add the ability to reduce ratios derived from prime divisions.
  • Move the gem's version from the gemspec file, into a separate file, that will be changing more often.

Some of the approximation features were in nascent form in previous releases. In
this release, we want to bring them closer to completion. Enhancements include:

* Add a Tonal::Ratio::Approximation::Set class to maintain the approximations
  and on which methods concerned with them can be located.
* Add a #by_superparticular strategy for finding approximate ratios.
* Rename the #approx method to #approximate, which reads better.

Additional changes include:

* Enhance the #superparticular method to allow assigning the superior part to
  the numerator (default) or denominator. This allows approaching target ratios
  from below as well as above. Also, add a factor argument, allowing finding
  superparticular ratios approaching any desired target ratio.
* Change the method name #normalize to #denominize. Normalize suggests extra
  undesired meaning. Denominize is a made up term, but its meaning is closer to
  what the method is actually doing.
* Extract the precision argument, located in method signatures, into a constant
  named PRECISION.
* Improve the readability of Tonal::Ratio#efficiency, by limiting its precision
  to 2 decimal places.
* Make available to_cents from instances of Tonal::Interval.
* Make ratio an alias to Tonal::Interval#interval.
* Add the ability to reduce ratios derived from prime divisions.
* Move the gem's version from the gemspec file, into a separate file, that will
  be changing more often.
@jolohaga jolohaga merged commit 0485b6e into main Feb 13, 2024
@jolohaga jolohaga deleted the improve-approximation branch February 13, 2024 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant